package com.gnerv.battle.boot.security.service;

import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @author Gnerv LiGen
 */
public abstract class AbstractUrlPermissionService {

    public abstract String selectPermission(String url, String type);

    public boolean verify(Collection<? extends GrantedAuthority> authorities, String permission) {
        return authorities.stream().anyMatch(item ->
                item.getAuthority().equals(permission)
        );
    }

}
